<template>
	<view class="baseList" :style="{marginTop:marginTop+'px'}">
		<view class="baseList_item" v-for="(item,index) in dataList" :key='index'>
			<view class="baseList_item_top">
				<view class="baseList_item_form">
					<view class="baseList_item_title font-weight-blod">{{item.name}}</view>
					<view class="baseList_item_type "
						:class="{'type_err':item.status==0,'type_success':item.status==1}">
						{{item.status==0?'申请中':'已通过'}}
					</view>
				</view>


				<template v-if="type==1">
					<view class="baseList_item_form">
						<view class="baseList_item_title">管理员姓名</view>
						<view class="baseList_item_type">{{item.wechat_json.contact_name || '暂无'}}</view>
					</view>
					<view class="baseList_item_form">
						<view class="baseList_item_title">联系电话</view>
						<view class="baseList_item_type">{{item.wechat_json.mobile_phone || '暂无'}}</view>
					</view>
					<view class="baseList_item_form">
						<view class="baseList_item_title">开户银行</view>
						<view class="baseList_item_type">{{item.wechat_json.account_bank || '暂无'}}</view>
					</view>
					<view class="baseList_item_form">
						<view class="baseList_item_title">费率</view>
						<view class="baseList_item_type">{{item.wechat || '暂无'}}</view>
					</view>
				</template>


				<template v-if="type==2">

					<view class="baseList_item_form">
						<view class="baseList_item_title">店铺名称</view>
						<view class="baseList_item_type">{{item.alipay_json.ShopName || '暂无'}}</view>
					</view>
					<view class="baseList_item_form">
						<view class="baseList_item_title">联系人姓名</view>
						<view class="baseList_item_type">{{item.alipay_json.ContactName || '暂无'}}</view>
					</view>
					<view class="baseList_item_form">
						<view class="baseList_item_title">联系人手机</view>
						<view class="baseList_item_type">{{item.alipay_json.ContactMobile || '暂无'}}</view>
					</view>
					<view class="baseList_item_form">
						<view class="baseList_item_title">费率</view>
						<view class="baseList_item_type">{{item.alipay || '暂无'}}</view>
					</view>
				</template>



				<view class="baseList_item_form">
					<view class="baseList_item_title">变更时间</view>
					<view class="baseList_item_type">{{item.date_creation | format}}</view>
				</view>
			</view>
			<view class="baseList_item_bottom">
				<view class="baseList_item_bottom_l">
					<!-- 			<view class="u-m-r-30">关闭通道</view>
					<view class="">录入资料</view> -->
				</view>
				<view class="" @click="onDeteil(index)">详情</view>
			</view>
		</view>
		<sww-login />
	</view>
</template>

<script>
	import {
		pagingMixin
	} from '@/mixins/sysPaging.js'
	import {
		formatDate
	} from '@/utils/moment'
	export default {
		mixins: [pagingMixin],
		props: {
			marginTop: {
				type: Number,
				default: 0
			},
			type: {
				type: String,
				default: '1' //  1微信  2支付宝 
			},
			params: {
				type: Object,
				default: () => {
					return {}
				}
			}
		},
		data() {
			return {
				dataObj: {}, //页面传参
			};
		},
		filters: {
			format(time) {
				return formatDate(time, 'YYYY-MM-DD HH:mm:ss')
			}
		},

		created() {
			this.initPage()
		},

		computed: {
			paramsObj() {
				return {
					type: this.type,
					supplier_id: this.vuex_adminuser.supplier_id,
					...this.params
				}
			},
		},

		methods: {

			initPage() {

				this._init_data('GetCollectionStoreList', this.paramsObj, {
					callBack: (res) => {
						res.forEach((el, index) => {
							el.wechat_json = !el.wechat_json ? {} : JSON.parse(el.wechat_json)
							el.alipay_json = !el.alipay_json ? {} : JSON.parse(el.alipay_json)
						})
						return res
					}
				})
			},

			$onReachBottom() {
				this._load_data({
					callBack: (res) => {
						res.forEach((el, index) => {
							el.wechat_json = !el.wechat_json ? {} : JSON.parse(el.wechat_json)
							el.alipay_json = !el.alipay_json ? {} : JSON.parse(el.alipay_json)
						})
						return res
					}
				})
			},

			onDeteil(index) {
				let {
					type,
					$to
				} = this
				this.dataObj = this.dataList[index]

				if (type == 2) this.$to(`/package/supplierSide/paymentChannel/alipay/applyForm/index?sumbitShow=false`)
				if (type == 1) this.$to(`/package/supplierSide/paymentChannel/weChat/applyForm/index?sumbitShow=false`)
			},

		}
	};
</script>
<style>
	page {
		background-color: #f5f5f5;
		color: rgba(0, 0, 0, .6);

	}
</style>
<style lang="scss" scoped>
	.baseList {
		.baseList_item {
			background-color: #ffffff;
			padding: 20rpx 26rpx;
			margin-bottom: 26rpx;

			.type_err {
				color: red;
				font-weight: bold;
			}

			.type_success {
				color: #42b983;
				font-weight: bold;
			}

			.baseList_item_top {
				border-bottom: 1rpx solid rgba(0, 0, 0, .1);
				padding-bottom: 20rpx;

				.baseList_item_form {
					margin-bottom: 18rpx;
					display: flex;
					justify-content: space-between;

					&:nth-last-of-type(1) {
						margin-bottom: 0;
					}
				}


			}

			.baseList_item_bottom {
				display: flex;
				justify-content: space-between;
				margin-top: 10rpx;
				color: #0090FF;

				.baseList_item_bottom_l {
					display: flex;

				}
			}


		}
	}

	.font-weight-blod {
		font-weight: bold;
	}
</style>
